package com.example.vv.model.home.base.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.example.vv.R;
import com.example.vv.frameWork.entity.HomeEntity;
import com.example.vv.frameWork.view.MyAdapter;
import com.example.vv.model.songInfo.SongInfoAct;

public class HomeAdapter extends MyAdapter<HomeEntity.Song, HomeAdapter.ViewHolder> {



    public HomeAdapter(Context mContext) {
        super(mContext);
    }

    @Override
    public int setLayout() {
        return R.layout.item_home;
    }

    @Override
    public ViewHolder setViewHolder(View view) {
        return new ViewHolder(view);
    }

    @Override
    protected void initView(HomeEntity.Song data, int position, ViewHolder viewHolder) {
            viewHolder.home_item_image.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mContext.startActivity(new Intent(mContext, SongInfoAct.class));
                }
            });
    }

    public static
    class ViewHolder extends RecyclerView.ViewHolder {
        public View rootView;
        public ImageView home_item_image;
        public TextView home_item_singer_name;
        public TextView home_item_song_name;

        public ViewHolder(View rootView) {
            super(rootView);
            this.rootView = rootView;
            this.home_item_image = (ImageView) rootView.findViewById(R.id.home_item_image);
            this.home_item_singer_name = (TextView) rootView.findViewById(R.id.home_item_singer_name);
            this.home_item_song_name = (TextView) rootView.findViewById(R.id.home_item_song_name);
        }

    }
}
